package member.controller;


import com.feign.utils.R;
import member.domain.MemberReceiveAddress;
import member.service.MemberReceiveAddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 会员收货地址(MemberReceiveAddress)表控制层
 *
 * @author panghu
 * @since 2023-03-04 21:10:51
 */
@RestController
@RequestMapping("member/memberReceiveAddress")
public class MemberReceiveAddressController {

    @Autowired
    private MemberReceiveAddressService memberReceiveAddressService;

    @PostMapping("save")
    public R save(@RequestBody MemberReceiveAddress memberReceiveAddress) {
        memberReceiveAddressService.saveMember(memberReceiveAddress);
        return R.ok("新增成功");
    }

    @PostMapping("update")
    public R update(@RequestBody MemberReceiveAddress memberReceiveAddress) {
        memberReceiveAddressService.updateMemberById(memberReceiveAddress);
        return R.ok("更新成功");
    }

    @GetMapping("info/{id}")
    public R info(@PathVariable Long id) {
        MemberReceiveAddress memberReceiveAddress = memberReceiveAddressService.getById(id);
        return R.ok().setData(memberReceiveAddress);
    }

    @DeleteMapping("remove/{id}")
    public R remove(@PathVariable Long id) {
        memberReceiveAddressService.removeById(id);
        return R.ok("删除成功");
    }

}

